var data = [];
try {
	var meetingsLabel = Ti.UI.createLabel({
		text : 'Upcoming Meetings',
		left : 0,
		top : 5,
		font: {fontSize:13, fontWeight:'bold'},
		color: '#fff'		
	});
	viewDetailsContainer.add(meetingsLabel);
	
	var meetings = usergroup.UpcomingMeetings;
	for ( var i = 0; i < meetings.length; i++) {
		var row = Ti.UI.createTableViewRow({height: 40});

		var titleLabel = Ti.UI.createLabel( {
			text : meetings[i].Title,
			left : 5,
			top : 5,
			right : 5,
			font: {fontSize:12},
			color: '#fff'
		});
		row.add(titleLabel);

		//var dateRegex = new RegExp();
		var results = /Date\((.*)\)/.exec(meetings[i].MeetingDate);
		var meetingDate = new Date(parseInt(results[1]));
		
		var dateLabel = Ti.UI.createLabel( {
			text : DotNetNuke.getTime(meetingDate) + ', ' + DotNetNuke.getLongDate(meetingDate)  ,
			left : 5,
			right: 5,
			bottom: 5,
			font: {fontSize:10},
			color: '#bb0'
		});		
		row.add(dateLabel);			
		
		row.className = 'meeting_row';
		row.usergroup = JSON.stringify(meetings[i]);
		
		data.push(row);
	}

	if (data.length == 0) {
		var noDataRow = Ti.UI.createTableViewRow({height: 25});

		var noDataLabel = Ti.UI.createLabel( {
			text : 'No Scheduled Meetings',
			left : 5,
			top : 5,
			right : 5,
			font: {fontSize:11},
			color: '#ccc'
		});
		noDataRow.add(noDataLabel);
		noDataRow.className = 'nomeeting_row';
		data.push(noDataRow);
	}
	
	var tableview = Ti.UI.createTableView( {
		data : data,
		top: 10,
		left: 0,
		bottom: 40,
		right: 0,
		height: 200,
		scrollable: true,
		separatorStyle: 0,
		separatorColor:'transparent' 
	});

	viewDetailsContainer.add(tableview);

//	tableview.addEventListener('click', function(e) {
//		Ti.App.Properties.setString('meeting_details', e.row.usergroup);
//		Ti.API.info(e.row.usergroup);
//		
//		var details = Ti.UI.createWindow({
//		    backgroundImage:DotNetNuke.getBackgroundImage(),
//		    navBarHidden: true,
//		    orientationModes: Ti.UI.PORTRAIT,
//		    url: 'usergroupdetails.js'
//		});
//		
//		Ti.API.info('Android: ' + DotNetNuke.isAndroid());
//		if (DotNetNuke.isAndroid()) {
//			removeMapView();
//		}
//		details.open();		
//	});
} catch (E) {
	alert(E);
}
